package com.haixiaoke.saas.order.service.impl;

import java.util.List;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.order.domain.OrderChargeItem;
import com.haixiaoke.saas.order.mapper.OrderChargeItemMapper;
import com.haixiaoke.saas.order.service.IOrderChargeItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单收费项目及价格Service业务层处理
 *
 * @author panda
 * @date 2024-04-03
 */
@Service
public class OrderChargeItemServiceImpl implements IOrderChargeItemService {
    @Autowired
    private OrderChargeItemMapper orderChargeItemMapper;

    /**
     * 查询订单收费项目及价格
     *
     * @param chargeId 订单收费项目及价格主键
     * @return 订单收费项目及价格
     */
    @Override
    public OrderChargeItem selectOrderChargeItemByChargeId(Long chargeId) {
        return orderChargeItemMapper.selectOrderChargeItemByChargeId(chargeId);
    }

    /**
     * 查询订单收费项目及价格列表
     *
     * @param orderChargeItem 订单收费项目及价格
     * @return 订单收费项目及价格
     */
    @Override
    public List<OrderChargeItem> selectOrderChargeItemList(OrderChargeItem orderChargeItem) {
        return orderChargeItemMapper.selectOrderChargeItemList(orderChargeItem);
    }

    /**
     * 新增订单收费项目及价格
     *
     * @param orderChargeItem 订单收费项目及价格
     * @return 结果
     */
    @Override
    public int insertOrderChargeItem(OrderChargeItem orderChargeItem) {
        orderChargeItem.setCreateTime(DateUtils.getNowDate());
        return orderChargeItemMapper.insertOrderChargeItem(orderChargeItem);
    }

    /**
     * 修改订单收费项目及价格
     *
     * @param orderChargeItem 订单收费项目及价格
     * @return 结果
     */
    @Override
    public int updateOrderChargeItem(OrderChargeItem orderChargeItem) {
        orderChargeItem.setUpdateTime(DateUtils.getNowDate());
        return orderChargeItemMapper.updateOrderChargeItem(orderChargeItem);
    }

    /**
     * 批量删除订单收费项目及价格
     *
     * @param chargeIds 需要删除的订单收费项目及价格主键
     * @return 结果
     */
    @Override
    public int deleteOrderChargeItemByChargeIds(Long[] chargeIds) {
        return orderChargeItemMapper.deleteOrderChargeItemByChargeIds(chargeIds);
    }

    /**
     * 删除订单收费项目及价格信息
     *
     * @param chargeId 订单收费项目及价格主键
     * @return 结果
     */
    @Override
    public int deleteOrderChargeItemByChargeId(Long chargeId) {
        return orderChargeItemMapper.deleteOrderChargeItemByChargeId(chargeId);
    }

    @Override
    public int insertBatchOrderChargeItem(List<OrderChargeItem> orderChargeItemList) {
        return orderChargeItemMapper.insertBatchOrderChargeItem(orderChargeItemList);
    }

    @Override
    public List<OrderChargeItem> selectOrderChargeItemByOrderId(String orderId) {
        return orderChargeItemMapper.selectOrderChargeItemByOrderId(orderId);
    }

    @Override
    public OrderChargeItem selectOrderChargeItemByOrderIdAndChargeType(String orderId, String chargeType) {
        return orderChargeItemMapper.selectOrderChargeItemByOrderIdAndChargeType(orderId, chargeType);
    }

    @Override
    public List<OrderChargeItem> selectOrderChargeItemByOrderIdOrLinkedOrderId(String orderId) {
        return orderChargeItemMapper.selectOrderChargeItemByOrderIdOrLinkedOrderId(orderId);
    }

    @Override
    public int updateOrderChargeItemByOrderId(String orderId, String houseId) {
        return orderChargeItemMapper.updateOrderChargeItemByOrderId(orderId, houseId);
    }
}
